$(document).ready(function(){
	var validator = $("#frmAddUser").validate({
		errorElement:'div',
		rules: {
			username: {
				required: true,
				//character:true,
				remote:SITEROOT+'/admin/settings/checkusernameexist.php'
			},
			first_name: {
				required: true,
				character:true
			},
			last_name: {
				required: true,
				character:true
			},
			email: {
				required: true,
				email: true,
				remote:SITEROOT+'/admin/settings/checkemailexist.php'
			}
		},
		messages: {
			username: {
				required: "Enter username",
				//character: "Please enter characters only",
				remote: jQuery.format("Username already in use")
			},
			first_name: {
				required: "Enter first name",
				character: "Please enter characters only",
			},
			last_name: {
				required: "Enter last name",
				character: "Please enter characters only",
			},
			email: {
				required: "Enter email address",
				email: "Enter valid email address",
				remote: jQuery.format("Email address already in use")
			}
		}
	});
	
	
	var validator = $("#frmEditUser").validate({
		errorElement:'div',
		rules: {
			username: {
				required: true,
				//character:true,
				remote:SITEROOT+'/admin/settings/checkusernameexist.php?id='+$("#hidden_userid").val()
			},
			first_name: {
				required: true,
				character:true
			},
			last_name: {
				required: true,
				character:true
			},
			email: {
				required: true,
				email: true,
				remote:SITEROOT+'/admin/settings/checkemailexist.php?id='+$("#hidden_userid").val()
			},
			mobno: {
				required: true
			}
		},
		messages: {
			username: {
				required: "Enter username",
				remote: jQuery.format("Username already in use")
			},
			first_name: {
				required: "Enter first name"
			},
			last_name: {
				required: "Enter last name"
			},
			email: {
				required: "Enter email address",
				email: "Enter valid email address",
				remote: jQuery.format("Email address already in use")
			}
			,
			mobno: {
				required: "Enter Mobile Number"
			}
		}
	});
	
	
});